﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UseImageList
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        DataTable datebase = new DataTable();

        private void Method(DataTable dt)
        {
            lw_View.Items.Clear();
            for (int i = 0; i <dt.Rows.Count; i++)
            {
                lw_View.Items.Add(dt.Rows[i][0].ToString(),0);
            }
        }
        private void bt_login_Click(object sender, EventArgs e)
        {
            if (tb_Pwd.Text !="" && tb_UserName.Text !="")
            {
                DataRow r;
                r = datebase.NewRow();
                r["userName"] = this.tb_UserName.Text;
                datebase.Rows.Add(r);
                Method(datebase);
            }
            else
            {
                MessageBox.Show("账号或密码不能为空!!!");
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DataColumn c = new DataColumn("名称");
            datebase.Columns.Add(c);
            lw_View.SmallImageList = imageList1;
            Method(datebase );
        }
    }
}
